This tutorial will lead you in excruciating detail through the process of creating a little level, one which consists of a main room, a fish tank, and a ramp leading up to an area above the fish tank so you can dive in and swim with the fishies. It should show you how many of the features of DukeEdit are used, including sloped sectors, shading, palettes, one kind of sectoreffector sprite, and the stratum window. The stratum window is not often used, but when you need it, you need it a lot.
You may find it useful to print this file out so it will be easy to refer to while in the throes of mapmaking.
Start by launching DukeEdit, and click on the 'new' button on the toolbar. It's on the upper left. You start off with a map the size of Texas, so we need to cut that down a bit. Click on the 'magnify' button on the toolbar (lower-left), move the mouse cursor over the red star (which is the default Duke position, red to let you know you haven't set it yet), and click three times. You should note that the title of the window is now 'Untitled0001 (8x)', and the 8x indicates eight-times magnification (a 2x for each click). Now go up to the grid menu and select a grid setting of 256x256. You should notice the grid on the screen now.
Step 1: Draw the main room.
The main room will be a large rectangle, 5632x2560 in DukeUnits. In case you are wondering, each grid square is 256 DukeUnits wide, hence the '256x256' menu item. To start off, move the mouse over the map and watch the info window. As you move it around, you should see the X and Y position change in the info window. I will give you drawing instructions using these X and Y positions, so familiarize yourself with this feature.
Now, go into Draw Mode by clicking on the Draw button from the toolbar. It's second from the bottom on the right side of the toolbar, with an icon shaped like an incomplete polygon. Move the mouse back over the map and notice that while over the map the cursor changes to a crosshair, for fine placement when needed. Since we are using a very coarse grid setting, fine placement will be unnecessary, but don't let this bother you. Keep things simple for now.
Move the mouse cursor to location X = -2560, Y = 1280 (from now on I'll just write -2560, 1280) and click once, move to 3072,1280 and click again, move to 3072,-1280 and click again, move to -2560,-1280 and click again, and lastly move back to where you started at -2560,1280 and click again. You should notice that with each mouse click after the first you laid down a new wall, and when you finally came full circle the program stopped drawing automatically and the drawing changed from brown to black. This is a visual cue that you have completed the drawing and can move on. You should also notice in the info window the message 'Created a sector', and perhaps also that as you were drawing, the info window contained the length of the line you are currently drawing and the angle of the line. If you missed it there will be plenty of opportunity to see it happen later. For now, we have work to do on this sector.
Change into sector mode using the toolbar -- it's the button with the complete polygon inside it, fourth from the bottom on the left. Move the cursor over the map and you will notice that whenever the cursor is inside our new sector the sector turns red, and turns back to black when you move the cursor outside it. Move the cursor inside the sector and double-click. Up pops a new kind of window, the sector window, titled so you know which sector you're looking at. Click on the 'Edit Sector' button and you are presented with the sector dialog, which is not to be confused with the sector window. Set the ceiling height to -40960 and leave the floor height at 0 (note: the Z coordinate in Duke Maps is inverted. This is not my doing). You will notice two radio buttons marked 'Edit Ceiling' and 'Edit Floor'. Leave it at 'Edit Ceiling' and, if needed, change the texture to 241 and the shade to 'Brightest' using the popup menu next to the shade edit box. Now switch to 'Edit Floor' using the radio button, and set the floor texture to 417, shade to 'Brightest', and click on the 'double smoosh' check box (i.e. double-smoosh should be checked).
A word or two on shading: The shading edit box will allow values from 0 to 255, but you will find that any setting above 32 is just as jet-black dark as 32, so only values from 0 to 32 are meaningful. In fact, a shading value of 16, which I call 'Neutral', is actually pretty darn dark. You should also notice that the popup menu will only set shading in multiples of 4. If you want more granularity than that, simply use the edit box. That's what it's there for.
Anyway, once you've got the values set properly, click on OK to dismiss the dialog.
So we've defined the shape of the main room, set the floor and ceiling height, texture and shading. Next, we work on the walls. Move the mouse cursor over the north wall of the sector (in the sector window) until the wall turns red, then double-click. This opens up the wall dialog. Change the wall texture to 233. You may have noticed that the 'X Repeat' and the 'Y Repeat' changed values. These fields control how the texture is drawn on the wall; how it is stretched in the X and Y direction as it is painted on the wall by the 3D game engine. DukeEdit automatically adjusts these to default values according to some convoluted rules whenever you change the texture so you don't get really ugly textures when you play the level. Anyway, that's the only thing you need to change in this dialog; click on OK to go back to the sector window.
Click on the 'All Walls' button to open up the 'Multi-Wall Editing' dialog, which allows you to change some things for all the walls in a sector at once. Whatever values you choose to 'include' will be applied to each wall in the sector if the 'All Walls' radio button is used, or will apply to all walls matching the given texture if the 'All Walls Matching Given Texture' is used. We want to use the 'All Walls' way, and include the texture 233. Click OK to dismiss the dialog and you should find that all the walls in the sector have texture 233. You can verify this feature from within the sector window by clicking once on each wall in the sector -- the texture of the selected wall appears on the sector window and you should see that they're all 233 (there is an exception wherein the wall should *not* have its texture changed, but that exception has to do with two-textured walls and does not apply here).
We are now done with the main room. Close the sector window using the close box.
One last note: you could have skipped the step where you do the wall dialog and gone straight to the 'All Walls' part; I had you do the extra step to introduce you to the wall dialog.
I described how to make this first sector in very fine detail; I will abbreviate somewhat for the upcoming sectors, but they all follow the same sort of steps: draw the outline of the sector, edit the sector to set up the floor and ceiling height, texture, shade and palette (when it applies), then change all the walls so they have appropriate textures and shading.
Step 2: Draw the Fish Tank
Change back to draw mode, and draw a sector just to the north of the main sector as follows:
click at -2560,-1536, then at 3072,-1536, then at 3072,-3072, then at -2560,-3072, then back to the original point. You should have a sector 5632 DukeUnits wide and 1536 DukeUnits long.
Change back to sector mode and double-click the sector to get to the sector window of the newly-created sector. Edit the sector and change ceiling height to -25600, floor height keep at 0, and change 'vis' to 32. 'vis' stands for 'visibility' and the larger the number, the murkier faraway objects seem, which is appropriate for a fishtank. Change the ceiling texture to 336 (which is the water texture, appropriate when you look up from a fish tank), the ceiling shade to 'Very Bright', and the ceiling palette to 'Blue' using the popup menu. Next, change the floor texture to 191, shade to 'Bright' and the palette to 'Blue'. Lastly, use the popup menu to change the sector tag to 'Underwater' (which changes the sector lotag to 2). This makes the sector so that when you go for a swim in the fishtank, it will seem like you're underwater.
Click OK to dismiss the sector dialog.
Click on the 'All Walls' button, include texture 191, shade 'Bright', and palette 'Blue'. Apply to all walls in the sector, and click OK.
Close the sector window. You're fish tank is done; but you can't see into it yet. We need a window between the two sectors.
Step 3: Make a window
Change to draw mode, and draw from -1792,-1536 to -1792,-1280 to 2304,-1280 to 2304,-1536 and then back to the first point again. This drawing connects the two sectors; notice that the wall separating the sectors is gray instead of black, indicating a 'two-sided' line (there's really no such thing, what is really the case is that the wall in each sector 'knows' there is another sector on the other side of the wall).
Change to sector mode, and double-click in the sector to bring up the sector window.
Edit the sector: set ceiling height to -20480, floor height to -6144, vis to zero, and sector tag to 'none'. Set ceiling texture to 191, and set floor and ceiling shade to 'Bright' and palette to 'Blue'. Click OK.
Click in 'All Walls', include texture 191, shade 'Bright', and palette 'Blue', click OK.
Close sector window.
We are not done with the window yet, right now Duke could walk right through it, giving the fish tank the strange property of having vertical walls of water with nothing holding the water inside. Here's how you make the walls.
Change to magnify mode, click once.
Change the grid size to 128x128.
Choose draw mode, and 'split' the window sector by drawing from -1792,-1408 to 2304,-1408. Note the info window contains the message 'Sector split'. Where we split the sector is where our plexiglass will go.
Choose sector mode, and double-click on northernmost half of the split to get the sector window. Double-click on its southern wall to get the wall dialog. Set the 'Blocking Wall' and 'Hittable Wall' check boxes, and click in the 'Default Repeats, Pannings' button. Click OK.
Edit the sector and change the floor and ceiling palette to 'Standard', click OK.
Close the sector window.
Next, double-click on the southernmost half of the split to get to its sector window, double-click on its northern wall to get to the wall dialog. Again, set 'Blocking Wall', 'Hittable Wall', and click on the 'Default Repeats, Pannings' button, then click on OK.
Click on 'All Walls', include palette 'Standard' and click OK.
Close the sector window.
Step 4: Put some sharks in the fish tank
Bring the sprite floating window to the front if necessary. Use the popup menu to select the 'Enemy B' sprite set. You should see a shark sprite down at the bottom of the sprite window. Move the mouse cursor to the little 'pot' next to the word 'SHARK', and you should see the cursor change to a side-view of a hand picking something up. Click down and drag a shark to your fish tank at location 2304,-2304. Put another one at -1792,-2304.
Choose sprite mode by clicking on the toolbar button that has a little diamond in it, and then double-click on the eastern shark. This brings up the sprite dialog, and in the lower-right corner of the sprite dialog is the angle control. Set it to 180 degrees using either the control or the edit box, and click OK. This makes the shark point westward so it can swim into the tank. The other shark is already pointing in the right direction; new sprites by default have angles of 0 degrees.
Step 5: Align the wall textures and try out the level!
Choose sector mode, and double-click on the main room sector to get to the sector window.
Double-click on the southern wall, and if needed click on the 'Default Repeats, Pannings' button, and click OK. Then click on the 'Alignment' button, choose 'In this sector only' and click OK. This causes the southern wall to be used as a prototype and for the textures of all contiguous walls with the same texture as the southern wall to have their textures aligned to the southern wall, even taking into account things like windows.
Close the sector window.
Double-click on the fish tank sector to get to its sector window, double-click on the northern wall and click on 'Default Repeats, Pannings' if needed then click OK. Click on 'Alignment' but this time choose 'On Whole Map' and click OK. This similarly uses the northern wall as a prototype, but will go through the whole level aligning contiguous wall's textures to it so long as the textures in question match the original texture. In this case, all the texture 191's will align in the fish tank and the window sectors.
Close the sector window.
Choose Duke mode, using the toolbar button with Duke's face on it. Move the mouse to 256,0 and click & drag to the north; let go. This will place Duke at 256,0 and will make him face roughly northward when the level is played.
Save the map as FishTank.map, and quit DukeEdit for now.
To play the map, drag the Fishtank.map icon and drop it on the Duke Nukem application.
You should be standing outside the fishtank, watching the fishies. Notice the blue water and enjoy the perfectly aligned textures. Yahoo.
We are only halfway done -- we want to swim with the fishies!
Quit Duke Nukem for now, and dive back into DukeEdit; opening the FishTank.map file.
Set the grid to 256x256, and use the magnify tool to zoom in to 8x magnification.
Step 6: Make the lower alcove
Actually, before making the lower alcove, we will add a transport SECTOREFFECTOR sprite to the fish tank. This is how the game implements submersion; you actually transport from the 'above water' sector to the 'below water' sector. This is very straightforward, but with a few very important restrictions: (1) The 'above water' sector must be the exact same size and shape as the 'below water' sector, and (2) the SECTOREFFECTOR sprites (one in each sector) must be in the same relative place in each sector. So, since the 'below water' sector -- i.e. the fishtank -- is right here we might as well get the transporter sprite in here.
Bring up the sprites floating window, and use the popup menu to select the 'Special Effects' sprite set. Drag a SECTOREFFECTOR sprite to your map and drop it at location 2816,-2304.
Choose sprite mode and double-click on the SECTOREFFECTOR sprite. Set the angle to 180, the hitag to 2000, and use the Sector Effector popup to make it a 'Transport' sprite (this sets the lotag to 7). Click OK.
By the way, setting the hitag to 2000 provides a unique ID to the transport SECTOREFFECTOR sprite. Later, we will put another transport sprite in the sector above the fishtank, giving it a hitag of 2000 too, and the unique IDs of the two sprites tie them together, so that duke will transport from one sector to the other. This is vital in levels with more than one transportation effect, so you have to do it even if there is only one transport effect.
Now, on to the lower alcove.
Select draw mode, and draw a rectange that buds off of the main room: draw from 3072,1024 to 4608,1024 to 4608,0 to 3072,0 and then back to the first point.
Select sector mode, and double-click on the sector to get to the sector window.
Edit the sector, and set the ceiling height to -16384, leave the floor height at 0, and set the ceiling and floor shade to 'Very Bright'. Click OK.
Click on 'All Walls', include texture 233 and shade 'Very Bright'. Click OK.
Close sector window.
Step 7: Make area above fish tank
This is where we will finally use the stratum floating window. This window allows you to temporarily remove from the main map window all sectors and sprites except those between two heights. The sectors are still there, of course, they're just not drawn.
Bring the stratum window to the front. There is a Bot Z and a Top Z, currently set to huge numbers (one positive, one negative), so that way the whole map lies between the two extremes. Change the Bot Z value from +bignum to -25632 and click on the 'Set' button. You will note that the map changes drastically -- only the main room and lower alcove remain. They remain because they have very high ceilings and so stick up into the active stratum, which you just set to be from -25632 on up to 'infinity'. Now we can draw the upper portion of the fish tank. If we tried to do it without using the stratum window, DukeEdit would have tried to attach it to the existing sectors, which is wrong. We want it to be completely separate. Also, it is easier to work on the sector if the lower one is out of the picture temporarily. This way you won't get confused over which line or sprite is which.
So with the stratum window set as above, select draw mode. You will probably want to bring the info window to the front, if it is behind the stratum window, to help with the coordinates for the upcoming drawing.
Draw a rectangle from -2560,-1536 to 3072,-1536 to 3072,-3072 to -2560,-3072 and then back to the first point again.
Select sector mode, and double-click on the new sector. Notice that the floor has been set to the stratum bottom, and the ceiling is 16384 DukeUnits higher.
Edit the sector: set floor texture to 336 (water), the ceiling texture to 191, ceiling and floor shade to 'Semi Bright', and use the Sector Tag popup menu and choose 'Water'. This makes the sector so Duke can wade in and then dive. Click OK.
Click on 'All Walls', include texture 191, and shade 'Semi Bright'. Click OK.
Close the sector window.
Bring up the sprite window, and drag a SECTOREFFECTOR sprite to 2816,-2304.
Select sprite mode, and double-click on the new SECTOREFFECTOR sprite to get to the sprite dialog. Use the popup to make the sprite a 'Transport' sprite and set its hitag value to 2000.
Click OK.
The area above the fish tank is all ready for Duke to dive in -- we need to make a ramp so Duke can get up there.
Step 8: Make the upper alcove
Select draw mode, and draw a rectangle from 3072,-1792 to 4608,-1792 to 4608,-2816 to 3072,-2816, and back to the first point again.
Select sector mode, double-click on the upper alcove sector, and edit the sector.
Set the Sector Tag popup to 'None', the floor texture to 417 (double-smoosh), the ceiling texture to 241, and leave the ceiling and floor shades at 'Semi Bright'. Click OK.
Click on 'All Walls', include texture 233 and shade 'Semi Bright'. Click OK.
Close sector window.
Bring up the stratum floating window, and click 'Reset'. The whole map should now be visible.
You will probably want to bring the info window to the front, if the stratum window is covering it.
Step 9: Make the ramp
Select draw mode, and draw a rectangle from 3584,0 to 3584,-1792 to 4608,-1792 to 4608,0 and then back to the original point again.
Select sector mode, and double-click on the ramp sector to get the sector window.
Edit the sector, setting ceiling and floor shade to 'Bright'. Leave the ceiling height at -16384 and the floor height at 0. Click OK.
Click on 'All Walls', include texture 233 and shade 'Bright'. Click OK.
Select the southern wall. It should turn blue. Click on the button marked 'First Wall'. This makes the selected wall the 'first' wall, which is necessary, because we want this sector to slope from the lower alcove to the upper alcove, and the Duke game engine does this by making the sector slope away from the first wall. So we need the southern wall to be first.
Next, select the northern wall, so it turns blue, and click on the 'Alignment' button.
Choose 'Floor slope' and 'Ceiling slope' and click OK. This nifty little feature fills in the floor and ceiling slope values exactly so that the floor/ceiling will slope up at exactly the right angle so that when it gets to the top it meets the upper alcoves floor/ceiling. It knows which sector to match by which wall you selected; in this case we selected the wall which had the upper alcove on the other side of it.
Close the sector window.
Step 10: Align the textures on the level
You will find you do this a lot, since most changes you make will mess up whatever texture alignment you previously had. So here goes.
Select sector mode, and double-click on the main room, getting the sector window.
Select the south wall, so it turns blue.
Click on 'Alignment', choose 'On whole map' and click OK. This will align textures not just in the main room, but in both alcoves and the ramp as well.
Close the sector window.
Bring up the stratum window, change Bot Z to -25632 and click 'Set'.
Double-click on sector above fishtank, and when the sector window comes up select the north wall (turns blue).
Click on 'Alignment', choose 'In this sector only', click OK.
Close the sector window.
Click 'Reset' in the stratum window.
Since we didn't alter anything on the fish tank, there won't be any reason to align the textures there.
Step 11: Play the level again!
Save the game, quit DukeEdit, and drop the FishTank.map on the Duke Nukem application like you did before. This time you should be able to walk up to the top of the tank and dive in, and blast those sharks into little pieces. Yowzah!
I hope this little tutorial is useful, although it probably raised more questions than it answered. Play with things a little bit; that's where the fun is!
If your level doesn't quite work right (for whatever reason), edit it along with the FishTank.map I provide with the game and compare them to see where they differ. In all probability the mistake will be in my instructions above.